<?php


namespace app\api\model;

use app\api\controller\Code;
use think\Db;
use think\Model;

/**
 * AI聊天
 * Class QwenModel
 * @package app\api\model
 *
 */
class QwenModel extends Model
{

    /**
     * 设置表名
     * @var string
     */
    protected $table = 'ah_qwen';


    /**
     *
     * 添加AI聊天记录
     */
    public static function qwenAdd($params){

        if (!isset($params['pid'])){

            $meeting['user_id'] = $params['user_id'];
            $meeting['case_id'] = $params['case_id'];
            $meeting['meeting_at'] = time();
            $meeting['type'] = 1;
            return MeetingModel::insertGetId($meeting);
        }else{

            return self::insertGetId($params);
        }

    }

    /**
     *
     * 聊天列表
     */
    public static function contentList($id,$pid){

        return self::where(['user_id'=>$id,'pid'=>$pid])->field('id,content,type')->select();
    }


}